package reflect;

import java.lang.reflect.Method;
import java.util.Scanner;

public class RefiectDemo1 {
    public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
       Class cls=String.class;
       String name= cls.getName();
        System.out.println(name);

        name=cls.getName();
        System.out.println(name);
        Method[] methods = cls.getMethods();//获取当前类对象所表示的类的所有公开方法
        for(Method method : methods){
            String methodName = method.getName();
            System.out.println(methodName);
        }

        Package pack = cls.getPackage();
        System.out.println(pack.getName());
    }
}
